<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //函数
        //抽取-封装 代码复用
        function fn() {
            alert('hhhhh')
        }
        //调用
        fn()
        function jiu() {
            for (let lx = 1; lx <= 9; lx++) {
                for (let hx = 1; hx <= lx; hx++)
                    document.write(`${lx}*${hx}=${lx * hx}`)
                document.write('<br>')
            }
        }
        jiu()
        jiu()
        jiu()
        function he() {
            let X = 10
            let Y = 20
            console.log(X + Y);

        }
        function hehe() {
            let a = 1, sum = 0;
            while (a <= 100) {
                sum += a;
                a++;
            }
            console.log('1 到 100 的总和：', sum);

        }
        he()
        hehe()
        //函数传参 声明语法 有几个形参就要有几个实参
        function sr(num1, num2) {
            console.log(num1 + num2);

        }
        sr(+prompt('one'), +prompt('two'))
        function hee(a1, b) {
            let = sum1 = 0;
            while (a1 <= b) {
                sum1 += a1;
                a1++;
            }
            console.log('50到 100 的总和：', sum1);
        }
        hee(+prompt('1'), +prompt('2'))

    </script>
</body>

</html>